﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace FwProject.Migrations
{
    public partial class Update_To_fwyg_201809031337 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_DistributionInfoDetails_RestaurantTypenNumberInfo_RestaurantTypenNumberInfoId",
                table: "DistributionInfoDetails");

            migrationBuilder.AddColumn<long>(
                name: "DriverUserId",
                table: "LoadCar",
                nullable: true);

            migrationBuilder.AlterColumn<Guid>(
                name: "RestaurantTypenNumberInfoId",
                table: "DistributionInfoDetails",
                nullable: true,
                oldClrType: typeof(Guid));

            migrationBuilder.AddForeignKey(
                name: "FK_DistributionInfoDetails_RestaurantTypenNumberInfo_RestaurantTypenNumberInfoId",
                table: "DistributionInfoDetails",
                column: "RestaurantTypenNumberInfoId",
                principalTable: "RestaurantTypenNumberInfo",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_DistributionInfoDetails_RestaurantTypenNumberInfo_RestaurantTypenNumberInfoId",
                table: "DistributionInfoDetails");

            migrationBuilder.DropColumn(
                name: "DriverUserId",
                table: "LoadCar");

            migrationBuilder.AlterColumn<Guid>(
                name: "RestaurantTypenNumberInfoId",
                table: "DistributionInfoDetails",
                nullable: false,
                oldClrType: typeof(Guid),
                oldNullable: true);

            migrationBuilder.AddForeignKey(
                name: "FK_DistributionInfoDetails_RestaurantTypenNumberInfo_RestaurantTypenNumberInfoId",
                table: "DistributionInfoDetails",
                column: "RestaurantTypenNumberInfoId",
                principalTable: "RestaurantTypenNumberInfo",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
